package com.shigen.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shigen.demo.entity.LoginLog;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
public interface LoginLogMapper extends BaseMapper<LoginLog> {

  @Select("select count(1) from login_log where id= #{userid}")
  int getLoginCount(Integer userid);

  @Select("select count(1) from login_log where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(login_time)")
  int getActiveCountInSevenDays();

  List<Map<String, Object>> getPlatform();

  List<Map<String, Object>> getNetServer();

  List<Map<String, Object>> getVisitorsInServenDays();

  List<Map<String, Object>> getLoginCountInsevenDays();

  List<Map<String, Object>> getLoginFailedCountInsevenDays();

  List<Map<String, Object>> getPositionTopSeven();

  List<Map<String, Object>> getLivenessTopSeven();
}
